package com.geofitti.andoird;

import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class ProfileActivity extends Activity {
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.geofitti_profile);	
		
		final TextView proEmail = (TextView) findViewById(R.id.pro_email);
		final TextView proUsername = (TextView) findViewById(R.id.pro_username);
		final TextView proFav = (TextView) findViewById(R.id.pro_favorite);
		final TextView proLocation = (TextView) findViewById(R.id.pro_location);
		
		//final Button   editBtn = (Button) findViewById(R.id.btnEditProfile);
		
		try {
			String paramString = "?user_id=12";
			JSONObject jsonO = WebCall.doGet("http://icarus.cs.weber.edu/~km06559/geofitti.php/getProfile" + paramString);
			final String email 	  =	jsonO.getString("email");
			final String username =	jsonO.getString("username");
			final String favorite =	jsonO.getString("favorite");
			final String location = jsonO.getString("location");
			proEmail.setText(email);
			proUsername.setText(username);
			proFav.setText(favorite);
			proLocation.setText(location);
			
    	} catch (JSONException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		}
		
		
		
	}
}
